/*
 * Created by Christopher King
 * Copyright (C) 2007 Christopher King, All Rights Reserved.
 */

package us.cirion.adventure.engine.prerequisite;

import us.cirion.adventure.engine.Player;
import us.cirion.adventure.engine.PreRequisite;
import us.cirion.adventure.engine.Room;

/**
 * Requires that the player is currently within a particular room.
 * 
 * @author Chris
 */
public class PlayerInRoom implements PreRequisite
{

	private Player player;
	private Room location;

	/**
	 * Constructs a new requirement that the player is in this room.
	 * 
	 * @param player The player whose location will be examined.
	 * @param location The required location for the player.
	 */
	public PlayerInRoom(Player player, Room location)
	{
		this.player = player;
		this.location = location;
	}

	/**
	 * Indicates whether the player is within this room.
	 * 
	 * @return <code>true</code> if the player is in this room,
	 *         <code>false</code> otherwise.
	 */
	public boolean isSatisfied()
	{
		return player.getCurrentLocation().equals(location);
	}

}
